package com.wolfman.wolfchat.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * @Title
 * @Description
 * @Author WolfMan
 * @Date 2022/1/15 0:41
 * @Email 2370032534@qq.com
 */
@Data
@TableName("message")
@EqualsAndHashCode(callSuper = true)
public class Message extends Model<Message> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 发送者id
     */
    @TableField("fromUserId")
    private Integer fromUserId;
    /**
     * 接收者id
     */
    @TableField("toUserId")
    private Integer toUserId;
    /**
     * 发送内容
     */
    private String message;

    /**
     * 发送时间
     */
    @TableField("createTime")
    private Date createTime;


    /*-------------------非持久化属性-------------------*/
    /**
     * 是否为系统消息
     */
    @TableField(exist = false)
    private Boolean isSystem;

    /**
     * 发送者
     */
    @TableField(exist = false)
    private User fromUser;
}
